package com.own.core.object.lookup;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

import com.own.core.html.form.textField.TextField;
import com.own.core.object.Dao;

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
@Table(name = "core_lookup")
public abstract class Lookup extends Dao {

	protected long id;

	@TextField(required = true, list = true)
	protected String name;

	public Lookup() {
	};

	public Lookup(String name) {
		this.name = name;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.TABLE)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String toString() {
		StringBuilder str = new StringBuilder();
		str.append("[ id =\"" + id + "\", name =\"" + name + "\"]");
		return str.toString();
	}

}
